<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父传子</title>
</head>
<body>
<div id="root">
    <child1 @send="send"></child1>
    传来的值是{{name}}
</div>
<template id="child1">

    <button @click="even">点击传值</button>
</template>
</body>
</html>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    let child1 = {
        template:"#child1",
        data: function () {
            return {
                value: "我是子标签的值"
            }
        },
        props: ["c1"],
        methods: {
            even() {
                this.$emit("send", this.value);
                console.log("jjjj")
            }

        }
    };
    let root = new Vue({
        el: "#root",
        data: {
            name: "",
        },
        methods: {
            send(a) {
                this.name = a;
                console.log("whah")
            }
        },
        components: {
            child1,
        }
    })
</script>